<?php
namespace App\Admin\Actions\Row;

use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Widgets\Modal;

class TableActions extends RowAction
{
    protected $title = '动态';

    protected $table;

    public function __construct($table)
    {
        $this->table = $table;

        parent::__construct($this -> title);
    }

    public function render()
    {
        $table = $this->table::make(['id' => $this->getKey()]);

        $button = <<<HTML
            <a><i class="feather icon-list text-warning"></i> <span class="text-warning">{$this->title}</span> </a>
        HTML;

        return Modal::make()
            ->xl()
            ->title($this->title)
            ->body($table)
            ->button($button);
    }
}
